﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>SQLiteDatabase</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>

<body><FONT size=2>
<P><FONT face=Courier size=4><STRONG>DBAdapter</STRONG> là do mình tạo ra<BR><B><FONT 
color=#7f0055 size=2>private</B>  
   </FONT><FONT size=2> </FONT><B><FONT 
color=#7f0055 size=2>static</B></FONT><FONT size=2> </FONT><B><FONT 
color=#7f0055 size=2>class</B></FONT><FONT size=2> DatabaseHelper 
</FONT><B><FONT color=#7f0055 size=2>extends</B></FONT><FONT size=2> 
SQLiteOpenHelper --&gt; mới chính là class tương tác với dữ liệu</P>
<P>&nbsp;</P></FONT></FONT><B><FONT color=#7f0055 size=2>
<P>private</B></FONT><FONT size=2> </FONT><B><FONT color=#7f0055 
size=2>static</B></FONT><FONT size=2> </FONT><B><FONT color=#7f0055 
size=2>final</B></FONT><FONT size=2> String </FONT><I><FONT size=2><FONT 
color=#0000ff><STRONG>DATABASE_NAME</STRONG></FONT></I></FONT><FONT size=2> = 
</FONT><FONT color=#2a00ff size=2>"MyDB"</FONT><FONT size=2>;</FONT></P>
<P><FONT size=2></FONT>&nbsp;</P>
<P><FONT><FONT face=Courier size=4>Settings /&nbsp;Application / Manage 
applications &gt;<BR>- Clear data --&gt; thì mất dữ liệu trong 
sqlite</FONT></FONT></P>
<P><FONT face=Courier size=4>không sợ 
việc create Database rồi create Database nữa thì mất, ko xảy ra chuyện đó<BR> 
    <BR>     
           </FONT><FONT><FONT 
face=Courier>@Override<BR>&nbsp;&nbsp;public void onUpgrade(SQLiteDatabase db, 
int oldVersion, int newVersion) {<BR>&nbsp;&nbsp;&nbsp;// TODO Auto-generated 
method stub<BR>&nbsp;&nbsp;&nbsp;Log.i(TAG, "Upgrading 
DB");<BR>&nbsp;&nbsp;&nbsp;db.execSQL("<FONT color=#ff0000>DROP TABLE IF EXISTS 
users</FONT>");<BR>&nbsp;&nbsp;&nbsp;onCreate(db);<BR>&nbsp;&nbsp;}</FONT></FONT></P>
<P><FONT><FONT 
face=Courier></FONT></FONT>&nbsp;</P>
<P><FONT><FONT face=Courier>Install 
lại không hề bị mất dữ liệu</FONT></P></FONT></FONT></body>
</html>
